package com.newshub.logging.config;

import com.newshub.logging.core.LogStorage;
import com.newshub.logging.core.SystemLogger;
import com.newshub.logging.implementation.file.FileLogStorage;
import com.newshub.logging.implementation.logback.LogbackLogger;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 日志系统自动配置
 */
@Slf4j
@Configuration
public class LoggingAutoConfiguration {
    
    @Bean
    @ConditionalOnMissingBean
    public LogStorage logStorage() {
        log.info("初始化文件日志存储");
        return new FileLogStorage();
    }
    
    @Bean
    @ConditionalOnMissingBean
    public SystemLogger systemLogger() {
        log.info("初始化Logback日志实现");
        return new LogbackLogger();
    }
}
